public class MainApplication {
    public static void main(String[] args) {
        // 创建Spring容器
        ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);

        // 获取TaskExecutor bean
        TaskExecutor taskExecutor = context.getBean(TaskExecutor.class);

        // 执行倒计时任务
        System.out.println("开始执行倒计时任务...");
        taskExecutor.executeCountdownTask();

        // 执行时间输出任务
        System.out.println("开始执行时间输出任务...");
        taskExecutor.executeTimeOutputTask();

        // 为了演示效果，让主线程等待一段时间
        try {
            Thread.sleep(60000); // 等待60秒，确保能看到倒计时结束
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        // 关闭线程池
        ThreadPoolExecutor executor = context.getBean(ThreadPoolExecutor.class);
        executor.shutdown();
    }
}
